import QtQuick

Window {
    id: root
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    QtObject{
        id: qmlObj
        property color bgColor: "#ff0000"
        property color textColor: Qt.rgba(0.1,0,0,1)
        property bool isRead: true
    }

    //对象属性遍历实现
    Component.onCompleted: {
        //C++实现
        CppPropertys.printPropertys(qmlObj);
        for(var p in qmlObj){
            console.log(p," type:",typeof p)
        }

        //Js实现
        console.log("keys:",Object.keys(qmlObj));
        console.log("values:",Object.values(qmlObj));
        console.log("entries:",Object.entries(qmlObj));

        for(let i = 0; i < Object.keys(qmlObj).length; i++){
            console.log("key:", Object.keys(qmlObj)[i],
                        " type:",typeof Object.values(qmlObj)[i],
                        " val:",Object.values(qmlObj)[i])

            var val = Object.values(qmlObj)[i].toString();
            if(val.indexOf("#") > -1){
                console.log("is Cccccccccc");
            }
        }

    }
}
